/***********************************************************************
 * Module:  Photo.java
 * Author:  Voja
 * Purpose: Defines the Class Photo
 ***********************************************************************/

package model;

import java.util.*;

public class Photo {
   public int imageId;
   public java.lang.String photoTitle;
   public java.lang.String photoDescription;
   public boolean photoPublic;
   public boolean photoTagsAllowed;
   public boolean photoNotesAllowed;
   public boolean photoCommentsAllowed;
   public java.lang.String imageLocation;
   public int imageWidth;
   public int imageHeight;
   public int imageSize;
   public java.util.Date imageUploadDate;
   
   public java.util.Collection<Tag> has_tag;
   public java.util.Collection<Rating> rating;
   public java.util.Collection<Note> note;
   public java.util.Collection<Comment> comment;
   public java.util.Collection<Album> has_photo;
   
   
   /** @pdGenerated default getter */
   public java.util.Collection<Tag> getHas_tag() {
      if (has_tag == null)
         has_tag = new java.util.HashSet<Tag>();
      return has_tag;
   }
   
   /** @pdGenerated default iterator getter */
   public java.util.Iterator getIteratorHas_tag() {
      if (has_tag == null)
         has_tag = new java.util.HashSet<Tag>();
      return has_tag.iterator();
   }
   
   /** @pdGenerated default setter
     * @param newHas_tag */
   public void setHas_tag(java.util.Collection<Tag> newHas_tag) {
      removeAllHas_tag();
      for (java.util.Iterator iter = newHas_tag.iterator(); iter.hasNext();)
         addHas_tag((Tag)iter.next());
   }
   
   /** @pdGenerated default add
     * @param newTag */
   public void addHas_tag(Tag newTag) {
      if (newTag == null)
         return;
      if (this.has_tag == null)
         this.has_tag = new java.util.HashSet<Tag>();
      if (!this.has_tag.contains(newTag))
      {
         this.has_tag.add(newTag);
         newTag.addHas_tag(this);      
      }
   }
   
   /** @pdGenerated default remove
     * @param oldTag */
   public void removeHas_tag(Tag oldTag) {
      if (oldTag == null)
         return;
      if (this.has_tag != null)
         if (this.has_tag.contains(oldTag))
         {
            this.has_tag.remove(oldTag);
            oldTag.removeHas_tag(this);
         }
   }
   
   /** @pdGenerated default removeAll */
   public void removeAllHas_tag() {
      if (has_tag != null)
      {
         Tag oldTag;
         for (java.util.Iterator iter = getIteratorHas_tag(); iter.hasNext();)
         {
            oldTag = (Tag)iter.next();
            iter.remove();
            oldTag.removeHas_tag(this);
         }
      }
   }
   /** @pdGenerated default getter */
   public java.util.Collection<Rating> getRating() {
      if (rating == null)
         rating = new java.util.HashSet<Rating>();
      return rating;
   }
   
   /** @pdGenerated default iterator getter */
   public java.util.Iterator getIteratorRating() {
      if (rating == null)
         rating = new java.util.HashSet<Rating>();
      return rating.iterator();
   }
   
   /** @pdGenerated default setter
     * @param newRating */
   public void setRating(java.util.Collection<Rating> newRating) {
      removeAllRating();
      for (java.util.Iterator iter = newRating.iterator(); iter.hasNext();)
         addRating((Rating)iter.next());
   }
   
   /** @pdGenerated default add
     * @param newRating */
   public void addRating(Rating newRating) {
      if (newRating == null)
         return;
      if (this.rating == null)
         this.rating = new java.util.HashSet<Rating>();
      if (!this.rating.contains(newRating))
      {
         this.rating.add(newRating);
         newRating.setPhoto(this);      
      }
   }
   
   /** @pdGenerated default remove
     * @param oldRating */
   public void removeRating(Rating oldRating) {
      if (oldRating == null)
         return;
      if (this.rating != null)
         if (this.rating.contains(oldRating))
         {
            this.rating.remove(oldRating);
            oldRating.setPhoto((Photo)null);
         }
   }
   
   /** @pdGenerated default removeAll */
   public void removeAllRating() {
      if (rating != null)
      {
         Rating oldRating;
         for (java.util.Iterator iter = getIteratorRating(); iter.hasNext();)
         {
            oldRating = (Rating)iter.next();
            iter.remove();
            oldRating.setPhoto((Photo)null);
         }
      }
   }
   /** @pdGenerated default getter */
   public java.util.Collection<Note> getNote() {
      if (note == null)
         note = new java.util.HashSet<Note>();
      return note;
   }
   
   /** @pdGenerated default iterator getter */
   public java.util.Iterator getIteratorNote() {
      if (note == null)
         note = new java.util.HashSet<Note>();
      return note.iterator();
   }
   
   /** @pdGenerated default setter
     * @param newNote */
   public void setNote(java.util.Collection<Note> newNote) {
      removeAllNote();
      for (java.util.Iterator iter = newNote.iterator(); iter.hasNext();)
         addNote((Note)iter.next());
   }
   
   /** @pdGenerated default add
     * @param newNote */
   public void addNote(Note newNote) {
      if (newNote == null)
         return;
      if (this.note == null)
         this.note = new java.util.HashSet<Note>();
      if (!this.note.contains(newNote))
      {
         this.note.add(newNote);
         newNote.setPhoto(this);      
      }
   }
   
   /** @pdGenerated default remove
     * @param oldNote */
   public void removeNote(Note oldNote) {
      if (oldNote == null)
         return;
      if (this.note != null)
         if (this.note.contains(oldNote))
         {
            this.note.remove(oldNote);
            oldNote.setPhoto((Photo)null);
         }
   }
   
   /** @pdGenerated default removeAll */
   public void removeAllNote() {
      if (note != null)
      {
         Note oldNote;
         for (java.util.Iterator iter = getIteratorNote(); iter.hasNext();)
         {
            oldNote = (Note)iter.next();
            iter.remove();
            oldNote.setPhoto((Photo)null);
         }
      }
   }
   /** @pdGenerated default getter */
   public java.util.Collection<Comment> getComment() {
      if (comment == null)
         comment = new java.util.HashSet<Comment>();
      return comment;
   }
   
   /** @pdGenerated default iterator getter */
   public java.util.Iterator getIteratorComment() {
      if (comment == null)
         comment = new java.util.HashSet<Comment>();
      return comment.iterator();
   }
   
   /** @pdGenerated default setter
     * @param newComment */
   public void setComment(java.util.Collection<Comment> newComment) {
      removeAllComment();
      for (java.util.Iterator iter = newComment.iterator(); iter.hasNext();)
         addComment((Comment)iter.next());
   }
   
   /** @pdGenerated default add
     * @param newComment */
   public void addComment(Comment newComment) {
      if (newComment == null)
         return;
      if (this.comment == null)
         this.comment = new java.util.HashSet<Comment>();
      if (!this.comment.contains(newComment))
      {
         this.comment.add(newComment);
         newComment.setPhoto(this);      
      }
   }
   
   /** @pdGenerated default remove
     * @param oldComment */
   public void removeComment(Comment oldComment) {
      if (oldComment == null)
         return;
      if (this.comment != null)
         if (this.comment.contains(oldComment))
         {
            this.comment.remove(oldComment);
            oldComment.setPhoto((Photo)null);
         }
   }
   
   /** @pdGenerated default removeAll */
   public void removeAllComment() {
      if (comment != null)
      {
         Comment oldComment;
         for (java.util.Iterator iter = getIteratorComment(); iter.hasNext();)
         {
            oldComment = (Comment)iter.next();
            iter.remove();
            oldComment.setPhoto((Photo)null);
         }
      }
   }
   /** @pdGenerated default getter */
   public java.util.Collection<Album> getHas_photo() {
      if (has_photo == null)
         has_photo = new java.util.HashSet<Album>();
      return has_photo;
   }
   
   /** @pdGenerated default iterator getter */
   public java.util.Iterator getIteratorHas_photo() {
      if (has_photo == null)
         has_photo = new java.util.HashSet<Album>();
      return has_photo.iterator();
   }
   
   /** @pdGenerated default setter
     * @param newHas_photo */
   public void setHas_photo(java.util.Collection<Album> newHas_photo) {
      removeAllHas_photo();
      for (java.util.Iterator iter = newHas_photo.iterator(); iter.hasNext();)
         addHas_photo((Album)iter.next());
   }
   
   /** @pdGenerated default add
     * @param newAlbum */
   public void addHas_photo(Album newAlbum) {
      if (newAlbum == null)
         return;
      if (this.has_photo == null)
         this.has_photo = new java.util.HashSet<Album>();
      if (!this.has_photo.contains(newAlbum))
      {
         this.has_photo.add(newAlbum);
         newAlbum.addHas_photo(this);      
      }
   }
   
   /** @pdGenerated default remove
     * @param oldAlbum */
   public void removeHas_photo(Album oldAlbum) {
      if (oldAlbum == null)
         return;
      if (this.has_photo != null)
         if (this.has_photo.contains(oldAlbum))
         {
            this.has_photo.remove(oldAlbum);
            oldAlbum.removeHas_photo(this);
         }
   }
   
   /** @pdGenerated default removeAll */
   public void removeAllHas_photo() {
      if (has_photo != null)
      {
         Album oldAlbum;
         for (java.util.Iterator iter = getIteratorHas_photo(); iter.hasNext();)
         {
            oldAlbum = (Album)iter.next();
            iter.remove();
            oldAlbum.removeHas_photo(this);
         }
      }
   }

}